var vueApp = new Vue({
  el: '#app',
  data: function () {
    return { 
    	colnum:2,
        datalist: [],
        collist: [],  
        name:"", 
        desc:"惜缘:18522501209  刘亚楠:15122027277  手台号:432.500",
        arr: [],        
      };
  },

  mounted: function () {
	 var obj={};
	 obj= {"tb":[{"info":"客户端","collist":[{"colname":"A"},{"colname":"B"}],"rowlist":[{"places":"汉文报融媒体中心-新闻编辑部","lines":[{"name":"A","datas":[{"name":"张三1"},{"name":"张三2"}]},{"name":"B","datas":[{"name":"王五1"},{"name":"王五2"},{"name":"王五3"},{"name":"王五4"},{"name":"王五5"}]}]},{"places":"部门二","lines":[{"name":"A","datas":[{"name":"赵六1"},{"name":"赵六2"}]},{"name":"B","datas":[{"name":"王八1"},{"name":"王八2"}]}]}]},{"info":"报端","collist":[{"colname":"A"},{"colname":"B"}],"rowlist":[{"places":"部门一","lines":[{"name":"A","datas":[{"name":"李四1"},{"name":"李四2"}]},{"name":"B","datas":[{"name":"张三1"}]}]},{"places":"部门二","lines":[{"name":"A","datas":[]},{"name":"B","datas":[{"name":"刘九1"},{"name":"刘九2"}]}]}]}]};
	 obj={"tb":[{"info":"客户端","collist":[{"colname":"A队"},{"colname":"B队"}],"rowlist":[{"places":"5:00～北辰双街(开往市区)","lines":[{"name":"A","datas":[{"name":"张三1"},{"name":"张三2"}]},{"name":"B","datas":[{"name":"王五1"},{"name":"王五2"},{"name":"王五3"},{"name":"王五4"},{"name":"王五5"}]}]},{"places":"5:05～北辰中医对面（天桥下）","lines":[{"name":"A","datas":[{"name":"赵六1"},{"name":"赵六2"}]},{"name":"B","datas":[{"name":"王八1"},{"name":"王八2"}]}]}]},{"info":"报端","collist":[{"colname":"A队"},{"colname":"B队"}],"rowlist":[{"places":"5:10～北辰东方之珠对面","lines":[{"name":"A","datas":[{"name":"李四1"},{"name":"李四2"}]},{"name":"B","datas":[{"name":"张三1"}]}]},{"places":"5:20～西沽公园对面（天桥下）","lines":[{"name":"A","datas":[]},{"name":"B","datas":[{"name":"刘九1"},{"name":"刘九2"}]}]}]}]};
	 obj={"tb":[{"info":"陈师傅 津C05352 53座","collist":[{"colname":"A队"},{"colname":"B队"}],"rowlist":[{"places":"5:00～北辰双街(开往市区)","lines":[{"name":"A","datas":[{"name":"张三1"},{"name":"张三2"}]},{"name":"B","datas":[{"name":"王五1"},{"name":"王五2"},{"name":"王五3"},{"name":"王五4"},{"name":"王五5"}]}]},{"places":"5:05～北辰中医对面（天桥下）","lines":[{"name":"A","datas":[{"name":"赵六1"},{"name":"赵六2"}]},{"name":"B","datas":[{"name":"王八1"},{"name":"王八2"}]}]}]},{"info":"于师傅 津C69195 55座","collist":[{"colname":"A队"},{"colname":"B队"}],"rowlist":[{"places":"5:10～北辰东方之珠对面","lines":[{"name":"A","datas":[{"name":"李四1"},{"name":"李四2"}]},{"name":"B","datas":[{"name":"张三1"}]}]},{"places":"5:20～西沽公园对面（天桥下）","lines":[{"name":"A","datas":[]},{"name":"B","datas":[{"name":"刘九1"},{"name":"刘九2"}]}]}]}]};
	 obj={"tb":[{"info":"2021年1月8日 周五 晚  18:30\n","info_id":"1","collist":[{"colname":"网名","name":"A"}],"rowlist":[{"places":"正达酒店（天津市\n河北区万柳村大街\n6号）【地铁3，6号线，\n北站D2出口’】","places_id":"t","lines":[{"colname":"网名","name":"A","datas":[{"name":"安全张","tel":"","real_name":"安全张","cert_id":""},{"name":"东哥","tel":"","real_name":"东哥/油田","cert_id":""},{"name":"大元帅","tel":"","real_name":"大元帅","cert_id":""},{"name":"文志","tel":"","real_name":"文志","cert_id":""},{"name":"淡雅伊","tel":"","real_name":"淡雅伊","cert_id":""},{"name":"普迈","tel":"","real_name":"普迈","cert_id":""},{"name":"任晓蓓","tel":"","real_name":"任晓蓓","cert_id":""},{"name":"彦懿","tel":"","real_name":"彦懿","cert_id":""},{"name":"海河","tel":"","real_name":"海河","cert_id":""},{"name":"喃喃","tel":"","real_name":"喃喃","cert_id":""},{"name":"方哥","tel":"","real_name":"方哥","cert_id":""},{"name":"瑞","tel":"","real_name":"瑞","cert_id":""},{"name":"聆听小雨","tel":"","real_name":"聆听小雨","cert_id":""},{"name":"稻草人","tel":"","real_name":"稻草人","cert_id":""},{"name":"悠然","tel":"","real_name":"悠然","cert_id":""},{"name":"海河之子","tel":"","real_name":"海河之子","cert_id":""},{"name":"陈娜","tel":"","real_name":"陈娜","cert_id":""},{"name":"上校","tel":"","real_name":"上校","cert_id":""},{"name":"浅笑","tel":"","real_name":"浅笑","cert_id":""},{"name":"87","tel":"","real_name":"87","cert_id":""},{"name":"燕归来","tel":"","real_name":"燕归来","cert_id":""},{"name":"A韩姐","tel":"","real_name":"A韩姐","cert_id":""},{"name":"建祺","tel":"","real_name":"建祺","cert_id":""},{"name":"田田","tel":"","real_name":"田田","cert_id":""},{"name":"大山","tel":"","real_name":"大山","cert_id":""},{"name":"于诗员（挂）","tel":"","real_name":"于诗员（挂）","cert_id":""},{"name":"米兰","tel":"","real_name":"米兰","cert_id":""},{"name":"熊熊仔仔","tel":"","real_name":"熊熊仔仔","cert_id":""},{"name":"静","tel":"","real_name":"静","cert_id":""},{"name":"山谷","tel":"","real_name":"山谷","cert_id":""},{"name":"维拉","tel":"","real_name":"维拉","cert_id":""},{"name":"随风","tel":"","real_name":"随风","cert_id":""},{"name":"lin张姐","tel":"","real_name":"ling","cert_id":""},{"name":"寒梅","tel":"","real_name":"寒梅","cert_id":""},{"name":"大花花","tel":"","real_name":"花开不败姐的姿态","cert_id":""},{"name":"希姐挂","tel":"","real_name":"昆","cert_id":""},{"name":"仲明","tel":"","real_name":"仲明","cert_id":""},{"name":"大翠挂-绳索","tel":"","real_name":"大翠挂-绳索","cert_id":""},{"name":"惜缘","tel":"","real_name":"惜缘","cert_id":""},{"name":"小鱼儿","tel":"","real_name":"小鱼儿","cert_id":""},{"name":"默刺青一墨","tel":"","real_name":"默刺青一墨","cert_id":""},{"name":"秦城少帅Ace","tel":"","real_name":"秦城少帅Ace","cert_id":""},{"name":"周芳","tel":"","real_name":"周芳","cert_id":""},{"name":"冬颜","tel":"","real_name":"冬颜","cert_id":""},{"name":"鱼哥","tel":"","real_name":"鱼哥","cert_id":""},{"name":"志山","tel":"","real_name":"志山","cert_id":""},{"name":"缘分天空","tel":"","real_name":"缘分天空","cert_id":""},{"name":"郑春江","tel":"","real_name":"郑春江","cert_id":""},{"name":"于诗员","tel":"","real_name":"于诗员","cert_id":""},{"name":"睡莲","tel":"","real_name":"睡莲","cert_id":""},{"name":"发发","tel":"","real_name":"发发","cert_id":""},{"name":"蓝天大海","tel":"","real_name":"蓝天大海","cert_id":""},{"name":"静悄悄","tel":"","real_name":"静悄悄","cert_id":""},{"name":"静姐","tel":"","real_name":"静姐","cert_id":""},{"name":"娜是","tel":"","real_name":"娜是","cert_id":""},{"name":"诚信一族","tel":"","real_name":"诚信一族","cert_id":""},{"name":"我又不乱来","tel":"","real_name":"我又不乱来","cert_id":""},{"name":"齐哥","tel":"","real_name":"齐哥","cert_id":""},{"name":"兔子","tel":"","real_name":"兔子","cert_id":""},{"name":"李卫","tel":"","real_name":"李卫","cert_id":""},{"name":"玉国哥","tel":"","real_name":"玉国哥","cert_id":""},{"name":"美丽","tel":"","real_name":"美丽","cert_id":""},{"name":"我心依旧","tel":"","real_name":"我心依旧","cert_id":""},{"name":"我是双眼皮","tel":"","real_name":"我是双眼皮","cert_id":""},{"name":"寒雨","tel":"","real_name":"寒雨","cert_id":""},{"name":"独角戏","tel":"","real_name":"独角戏","cert_id":""},{"name":"青瓷","tel":"","real_name":"青瓷","cert_id":""},{"name":"杨琴","tel":"","real_name":"杨琴","cert_id":""},{"name":"东温而夏清","tel":"","real_name":"冬温而夏清","cert_id":""},{"name":"晨晨","tel":"","real_name":"晨晨","cert_id":""},{"name":"13...","tel":"","real_name":"13...","cert_id":""},{"name":"大翠","tel":"","real_name":"大翠","cert_id":""},{"name":"沙漠","tel":"","real_name":"沙漠","cert_id":""},{"name":"不在荒唐","tel":"","real_name":"不在荒唐","cert_id":""},{"name":"希姐","tel":"","real_name":"希姐","cert_id":""},{"name":"妮子","tel":"","real_name":"妮子","cert_id":""},{"name":"小山娃","tel":"","real_name":"小山娃","cert_id":""},{"name":"小华","tel":"","real_name":"小华","cert_id":""},{"name":"小敏","tel":"","real_name":"小敏","cert_id":""},{"name":"周鹏","tel":"","real_name":"周鹏","cert_id":""}]}]}]}]};
	 this.datalist=obj.tb;
	 this.collist=this.datalist[0].collist;
	 this.name="10月17日迁安挂云山";	
	 //this.arr= this.filltoArr(this.datalist[0].rowlist[0].lines); 
	 //console.log(this.getMax(this.arr));      
	// console.log(this.getMaxIndex(this.arr));  
	  
	  
  },
  

  methods: {
	  
	  getItemdata:function(lines,lineindex,oindex)
	  {
		  var tmp="";
		    try {
		    	tmp=lines[lineindex].datas[oindex].name;
			}
			catch(err){
			    
			}
		return tmp
	  },
	  //行合计
	  getRowTotal:function(lines)
	  {
		   var total=0; 
		   lines.forEach(function(lines,idx){
				
					total += lines.datas.length;
				
			});
		   
		   return total
	  },
	  //列合计
	  getColTotal:function(rowlist,colindex)
	  {
		   var total=0; 
		   rowlist.forEach(function(row,idx){
				
					total += row.lines[colindex].datas.length;
				
			});
		   
		   return total
	  },
	  
	  colTotal:function(colindex)
	  {
		   var that=this;
		   var total=0; 
		   this.datalist.forEach(function(data,idx){
				
			   total+=that.getColTotal(data.rowlist,colindex);
				
			});
		   
		   return total
	  },
	  
	  //列合计累计
	  
	  getColTotalSum:function(rowlist,collen)
	  {
		  var total=0; 
		  for(var i=0;i<collen;i++)
		  {
		      total+=this.getColTotal(rowlist, i);
		  }
		 return  total;
		  
	  },
	  
	  
	  colTotalSum:function(collen)
	  {
		   var that=this;
		   var total=0; 
		   this.datalist.forEach(function(data,idx){				
			
			      for(var i=0;i<collen;i++)
				  {
				      total+=that.getColTotal(data.rowlist, i);
				  }
				
			});
		   
		   return total
	  },
	  
	  //返回合并行数 
	  getRowSpan:function(lines)
	  {
		 var arr=lines.map(function(item){			   	
         	 return item.datas.length;
          }); 
		 var maxValue=this.getMax(arr);
		 return Math.ceil(maxValue/this.colnum);
	  },
	  
	  
	  
      //获取最大值
	   getMax:function(arr) {
	      //假设最大值max 为arr[0]
	      var max = arr[0];
	      //遍历对比
	      for (var i = 0; i < arr.length; i++) {
	          //若max小于当前项 说明不是最大值 将当前项的值赋予max 
	          // 继续遍历对比找到最大的值
	          if (max < arr[i]) {
	              max = arr[i];
	          }
	      }
	      return max;
	  }, 
	
	  //获取最大值的下标
	   getMaxIndex: function(arr) {
	      var max = arr[0];
	      //声明了个变量 保存下标值
	      var index = 0;
	      for (var i = 0; i < arr.length; i++) {
	          if (max < arr[i]) {
	              max = arr[i];
	              index = i;
	          }
	      }
	      return index;
	  },
	  
	//获取最小值的下标
	   getMinIndex:function(arr) {
	      var min = arr[0];
	      //声明了个变量 保存下标值
	      var index = 0;
	      for (var i = 0; i < arr.length; i++) {
	          if (min > arr[i]) {
	              min = arr[i];
	              index = i;
	          }
	      }
	      return index;
	  },

	 //获取最小值
	   getMin: function(arr) {
	      var min = arr[0];
	      for (var i = 0; i < arr.length; i++) {
	          if (min > arr[i]) {
	              min = arr[i];
	          }
	      }

	      return min;
	  },
	  
	  
     
	  showError: function(info){		
    	 _alert(info);
      },
  },
  watch:{
     
  }
  
})